package com.ruoyi.zq.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.zq.service.VolunteerTimeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 *
 * @Author: LoneyFeather
 * @Date: Created in 15:20 2021/12/28
 */
@Api(tags = "志愿服务时长")
@RestController
@RequestMapping("/volunteerTime")
public class VolunteerTimeController extends BaseController {

    @Autowired
    private VolunteerTimeService volunteerTimeService;

    @PreAuthorize("@ss.hasPermi('zq:vlounteerTime:getInfo')")
    @ApiOperation("获取详细的志愿服务时长")
    @GetMapping("/getInfo/{userId}")
    public AjaxResult getInfo(@PathVariable Long userId){
        return AjaxResult.success(volunteerTimeService.get(userId));
    }


//    @PreAuthorize("@ss.hasPermi('zq:volunteerTime:update:time')")
//    @ApiOperation("增加志愿服务时长")
//    @PostMapping("/update/time")
//    public AjaxResult updateVolunteerTime(@RequestParam(value = "userId",required = true) Long userId,
//                                          @RequestParam(value = "time",required = true) int time){
//        return toAjax(volunteerTimeService.addVolunteerTime(userId,time));
//    }



}
